<?php

namespace App\Http\Model;

class Goods extends Base {

    protected $hidden = [
        'updated_at', 'created_at'
    ];

    public function getPriceAttribute($value)
    {
        //$value = '¥' . $value . '';
        return $value;
    }

    public function getImgUrlAttribute($value)
    {
        if (empty($value)) return $value;

        return env('CDN_DOMAIN') . $value;
    }

    public function getDetailAttribute($value)
    {
        $value = str_replace('[content]',  $value,  getCss());

        return $value;
    }

    public function images()
    {
        return $this->hasMany('App\Http\Model\GoodsImage');
    }

    public function comment()
    {
        return $this->hasMany('App\Http\Model\GoodsComment');
    }

}



